#!/usr/bin/env python
# encoding: utf-8
# @Time : 2020/6/23 22:31 
# @Author : 能量咖啡豆 
# @File : drawtest.py
# @desc : drawtest.py
import numpy as np
import matplotlib.pyplot as plt

def mandelbrot( h,w, maxit=20 ):
    y, x = np.ogrid[ -1.4:1.4:h*1j, -2:0.8:w*1j ]
    c = x + y * 1j
    z = c

    divtime = maxit + np.zeros(z.shape, dtype=int)
    for i in range(maxit):
        z = z ** 2 + c
        diverge = z * np.conj(z) > 2 ** 2  # who is diverging
        div_now = diverge & (divtime == maxit)  # who is diverging now
        divtime[div_now] = i  # note when
        z[diverge] = 2  # avoid diverging too much

    return divtime

def histogram():
    mu, sigma = 2, 0.5
    v = np.random.normal(mu, sigma, 10000)
    plt.hist(v, bins=50, density=1)
    plt.show()


if __name__ == "__main__":
    print("matplotlib test")
    histogram()